package com.huika.renrench.control.my.certification.activity;

import android.widget.TextView;

import com.huika.renrench.GlobalApp;
import com.huika.renrench.R;
import com.huika.renrench.control.common.base.BaseAct;
import com.huika.renrench.view.TitleBarHelper;

/**
 * 
 * @description：已认证
 * @author zc
 * @date 2015年6月2日 上午11:01:12
 */
public class AlreadyCertificationActivity extends BaseAct {

	private TextView name_detail;
	private TextView card_number_detail;
	
	@Override
	public void setRootView() {
		setContentView(R.layout.activity_already_certification);
	}
	
	@Override
	protected void initData() {
		super.initData();
		TitleBarHelper barHelper = new TitleBarHelper(this, -1);
		barHelper.setLeftMsg("返回");
		barHelper.setTitleMsg("实名认证");
	}
	
	@Override
	protected void initWidget() {
		super.initWidget();
		name_detail = (TextView) findViewById(R.id.name_detail);
		card_number_detail = (TextView) findViewById(R.id.card_number_detail);
		
		name_detail.setText(getHideRealName(GlobalApp.userModel.getRealName()));
		card_number_detail.setText(getHideIdCard(GlobalApp.userModel.getIdCard()));
	}
	
	private String getHideRealName(String realName) {
		StringBuffer sb = new StringBuffer(realName.substring(0, 1));
		int count = realName.length() - 1;
		for(int i = 0; i < count; i++) {
			sb.append('*');
		}
		return sb.toString();
	}
	
	private String getHideIdCard(String idCard) {
		StringBuffer sb = new StringBuffer(idCard.substring(0, 4));
		int count = idCard.length() - 8;
		for(int i = 0; i < count; i++) {
			sb.append('*');
		}
		sb.append(idCard.substring(idCard.length() - 4));
		return sb.toString();
	}

}
